﻿function panPoints(map, points, currentPosition, timeout, loop)
{
	if (points.length == currentPosition)
	{
		if (loop)
			currentPosition = 0
		else
			return;
	}
	
	map.panTo(points[currentPosition++]);
	
	window.setTimeout(function() { panPoints(map, points, currentPosition, timeout, loop); }, timeout);
}